using System;
using System.Collections.Generic;
using System.Linq;
using SuCasa.Controllers;
using SuCasa.Infrastructure;

namespace SuCasa.DataAccess{
    public class FakeSessionRepository : ISessionRepository {
        public List<Session> GetSessionsByCourse(Course course){
            return FakeDb.AllSessions.ToList();
        }

        public bool AddCourse(Course course){
            FakeDb.AllCourses.ToList().Add(course);
            return true;
        }

        public List<Course> GetAll(){
            return FakeDb.AllCourses.ToList();
        }

        public Course GetCourseBy(Func<Course, bool> func){
            return FakeDb.AllCourses.First();
        }

        public List<Session> GetSessionByCourseId(Course course){
            return FakeDb.AllSessions.ToList();
        }

        public bool AddSession(Member member, Course course){
            //that seems weird to not pass a session to this instead...
            FakeDb.AllSessions.ToList().Add(new Session
                {
                    StudentId = member.MemberId,
                    CourseId = course.CourseId,
                    Attended = true,
                    Grade = 0,
                    Homework = true,
                    SessionId = 20,
                    Timestamp = DateTime.Now
                });
            return true;
        }
    }
}